﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pseudogenerator.Common.Generators.Core;

namespace Pseudogenerator.Common.Generators
{
    public class MixedCongruential
        : Congruential
    {
        /// <summary>
        /// Constante aditiva
        /// </summary>
        public uint c { get; set; }

        public override bool CanGenerateNext 
        { 
            get 
            { 
                return a != 0 && c != 0 && m != 0; 
            } 
        }

        public override uint GetNextValue()
        {
            return ((a * ActualValue) + c) % m;
        }


        public override string ToString()
        {
            return string.Format("X₁ = (({0} ٠ {1}) + {3}) mod {2}", a, x0, m, c);
        }
    }
}
